package dao;

import java.sql.Connection;


import utils.Utils;


public abstract class GenericDao {
	protected Connection con;
	private String query;
	
	
	
	
	protected GenericDao() {
		con = ConnectionFactory.getConexao();

	}
	
	protected void setQuery(String query) {
		this.query = query;
	}
	protected String getQuery() {
		return query;
	}
	
	protected void addLimit(int limite, int inicio) {
		if (!Utils.isBlank(limite))
			this.setQuery(this.getQuery()+" limit "+limite+" offset "+inicio);
		
	}

	protected void addOrder(String order, String campo) {
		this.setQuery(this.getQuery()+" order by "+campo+" "+order);
		
	}
	
	protected void addAtivo(char ativo) {
		this.setQuery(this.getQuery()+" and ativo = '"+ativo+"'");
		
	}


	

	

	
		
	

	
	

}
